package com.fenqing.leetcode.code.t1700_1800;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

import java.util.Arrays;

public class Topic1720 extends Topic {

    public static void main(String[] args) {
        Topic1720 topic1720 = new Topic1720();
        int[] run = topic1720.run("[1,2,3]", "1");
        System.out.println(Arrays.toString(run));
    }

    @Execute
    public int[] decode(int[] encoded, int first) {
        int[] result = new int[encoded.length + 1];
        result[0] = first;
        for (int i = 0; i < result.length - 1; i++) {
            result[i + 1] = encoded[i] ^ result[i];
        }
        return result;
    }


}
